﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="MARC.EHRS.Silverlight.Selector"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <Grid x:Name="LayoutRoot" >
        <Grid.Resources>
            <Style x:Key="MenuButtonStyle" TargetType="RepeatButton">
                <Style.Setters>
                    <Setter Property="Padding" Value="10,0"/>
                    <Setter Property="Width" Value="32"/>
                    <Setter Property="Height" Value="32"/>
                    <Setter Property="Margin" Value="12"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="RepeatButton">
                                <Grid Name="Grid">
                                    <Grid.RenderTransform>
                                        <CompositeTransform TranslateX="0" TranslateY="0" ScaleX="1" ScaleY="1"/>
                                    </Grid.RenderTransform>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.ScaleY)" To="1" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.ScaleX)" To="1" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.TranslateX)" To="0" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.TranslateY)" To="0" Duration="0:0:0.1"/>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="MouseOver">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.ScaleY)" To="1.5" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.ScaleX)" To="1.5" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.TranslateX)" To="-12" Duration="0:0:0.1"/>
                                                    <DoubleAnimation Storyboard.TargetName="Grid" Storyboard.TargetProperty="(Grid.RenderTransform).(CompositeTransform.TranslateY)" To="-16" Duration="0:0:0.1"/>
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="Border" CornerRadius="6" BorderBrush="#22990033" BorderThickness="1">
                                    </Border>
                                    <ContentPresenter
                                        Content="{TemplateBinding Content}"
                                        ContentTemplate="{TemplateBinding ContentTemplate}"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Center">

                                    </ContentPresenter>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style.Setters>

            </Style>

            <Style x:Key="HorizontalListBoxStyle" TargetType="ListBox">
                <Setter Property="BorderBrush">
                    <Setter.Value>
                        <SolidColorBrush Color="Transparent"/>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="18"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <ContentPresenter Grid.Row="1" Height="200" Width="200" Content="{Binding PreviewControl}" SizeChanged="ContentPresenter_SizeChanged">
                                </ContentPresenter>
                                <sdk:Label FontWeight="Bold" HorizontalAlignment="Center" Content="{Binding Name}" Grid.Row="0" Foreground="White"/>
                            </Grid>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBox">
                            <ItemsPresenter/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="ListBoxItem">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Grid >
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal">
                                            <Storyboard Storyboard.TargetName="Border" >
                                                <ColorAnimation Storyboard.TargetProperty="(Border.Background).(RadialGradientBrush.GradientStops)[0].Color" To="Transparent" Duration="0:0:0.1"/>
                                                <ColorAnimation Storyboard.TargetProperty="(Border.Background).(RadialGradientBrush.GradientStops)[1].Color" To="Transparent" Duration="0:0:0.1"/>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="MouseOver">
                                            <Storyboard Storyboard.TargetName="Border" >
                                                <ColorAnimation Storyboard.TargetProperty="(Border.Background).(RadialGradientBrush.GradientStops)[1].Color" To="#5599ccff" Duration="0:0:0.3"/>
                                                <ColorAnimation Storyboard.TargetProperty="(Border.Background).(RadialGradientBrush.GradientStops)[0].Color" To="#AA99ccff" Duration="0:0:0.3"/>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Border Name="Border" CornerRadius="6" BorderBrush="#aaFFFFFF" BorderThickness="1">
                                    <Border.Background>
                                        <RadialGradientBrush GradientOrigin="0.6,0.3">
                                            <GradientStop Offset="0" Color="Transparent"/>
                                            <GradientStop Offset="1" Color="Transparent"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                    <ContentPresenter x:Name="contentPresenter"
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Stretch">
                                    </ContentPresenter>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <Grid.Background>
            <RadialGradientBrush>
                <GradientStop Offset="1" Color="#EE000000"/>
                <GradientStop Offset="0" Color="#CC000000"/>
            </RadialGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="256"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="64"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="64"/>
        </Grid.ColumnDefinitions>
        <RepeatButton Style="{StaticResource MenuButtonStyle}" Grid.Row="1" Grid.Column="0" Click="SelectorScrollLeft">
            <Image Source="1leftarrow.png" Stretch="UniformToFill" />
        </RepeatButton>
        <ScrollViewer Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" Padding="0" x:Name="lstSelectionScroll" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden">
            <ScrollViewer.BorderBrush>
                <SolidColorBrush Color="Transparent"/>
            </ScrollViewer.BorderBrush>
            <ListBox Background="Transparent" Style="{StaticResource HorizontalListBoxStyle}" ItemsSource="{Binding}" Name="lstSelection" SelectionChanged="lstSelection_SelectionChanged">
            </ListBox>
        </ScrollViewer>
        <RepeatButton Style="{StaticResource MenuButtonStyle}"  Grid.Row="1" Grid.Column="2" Click="SelectorScrollRight">
            <Image Source="1rightarrow.png" Stretch="UniformToFill"/>
        </RepeatButton>
    </Grid>
</UserControl>
